package model;

import static org.junit.Assert.*;

import java.util.GregorianCalendar;

import org.junit.Before;
import org.junit.Test;

public class DailyIrregularTest {

	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void testTotalDose() {
		DailyIrregular doses;
		
		doses= new DailyIrregular(new GregorianCalendar(2008,3,1), 
				new GregorianCalendar(2008,3,1));
		assertEquals(0, doses.totalDose());
		
		doses= new DailyIrregular(new GregorianCalendar(2008,3,1), 
				new GregorianCalendar(2008,3,2));	
		doses.createDose("13:23", 1);
		assertEquals(2, doses.totalDose());
		
		doses= new DailyIrregular(new GregorianCalendar(2008,3,1), 
				new GregorianCalendar(2008,3,10));
		doses.createDose("13:23", 1);
		doses.createDose("15:40", 2);
		assertEquals(30, doses.totalDose());	
		
		
		doses= new DailyIrregular(new GregorianCalendar(2008,3,2), 
				new GregorianCalendar(2008,5,1));
		doses.createDose("13:23", 1);
		doses.createDose("15:40", 2);
		doses.createDose("19:23", 4);
		assertEquals(427, doses.totalDose());	
		
		doses= new DailyIrregular(new GregorianCalendar(2008,3,1), 
				new GregorianCalendar(2009,3,1));
		doses.createDose("13:23", 1);
		doses.createDose("15:40", 2);
		doses.createDose("19:23", 4);
		doses.createDose("23:00", 8);
		assertEquals(5490, doses.totalDose());
		
	}

	@Test
	public void testDayDose() {
DailyIrregular Daydose;
		
		Daydose= new DailyIrregular(new GregorianCalendar(2008,3,1), 
				new GregorianCalendar(2008,3,1));
		assertEquals(0, Daydose.dayDose());
		
		Daydose= new DailyIrregular(new GregorianCalendar(2008,3,1), 
				new GregorianCalendar(2008,3,2));	
		Daydose.createDose("13:23", 1);
		assertEquals(1, Daydose.dayDose());
		
		Daydose= new DailyIrregular(new GregorianCalendar(2008,3,1), 
				new GregorianCalendar(2008,3,10));
		Daydose.createDose("13:23", 1);
		Daydose.createDose("15:40", 2);
		assertEquals(3, Daydose.dayDose());	
		
		
		Daydose= new DailyIrregular(new GregorianCalendar(2008,3,2), 
				new GregorianCalendar(2008,5,1));
		Daydose.createDose("13:23", 1);
		Daydose.createDose("15:40", 2);
		Daydose.createDose("19:23", 4);
		assertEquals(7, Daydose.dayDose());	
		
		Daydose= new DailyIrregular(new GregorianCalendar(2008,3,1), 
				new GregorianCalendar(2009,3,1));
		Daydose.createDose("13:23", 1);
		Daydose.createDose("15:40", 2);
		Daydose.createDose("19:23", 4);
		Daydose.createDose("23:00", 8);
		assertEquals(15, Daydose.dayDose());
	}
	}
		
		
	

	